package com.dw.dwdzcommerce.view.search;

import java.util.ArrayList;
import java.util.List;

import android.app.ActionBar;
import android.app.ActionBar.LayoutParams;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;

import com.dw.dwdzcommerce.R;
import com.dw.dwdzcommerce.base.activity.BaseActivity;
import com.dw.dwdzcommerce.entity.SearchHotGoods;
import com.dw.dwdzcommerce.view.search.searchPersenter.searchPersenterInterface;

public class SearchActivity extends BaseActivity implements searchPersenterInterface{

	// View actionbar;

	@Override
	protected void inCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub

		View view = setActionBarLayout(R.layout.item_serch_actionbar);
		

		Button button =findView(R.id.mcancel_bt_shbar);
		button.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Toast.makeText(getApplicationContext(), "jihua", 0).show();
			}
		});

		ListView history_lv_sh =findView(R.id.mhistory_lv_sh);
	
		List<SearchHotGoods> list =new ArrayList<SearchHotGoods>();
		
		SearchHotGoods goods =new SearchHotGoods("www.guanggong.com","xiaoming");
		SearchHotGoods goods1 =new SearchHotGoods("www.guanggong.com","xiaoming");
		SearchHotGoods goods2 =new SearchHotGoods("www.guanggong.com","xiaoming");
		SearchHotGoods goods3 =new SearchHotGoods("www.guanggong.com","xiaoming");
		list.add(goods);
		list.add(goods1);
		list.add(goods2);
		list.add(goods3);
		history_lv_sh.setAdapter(new Lvadpter(this,list));
		
		
	}

	@Override
	protected int getLayoutId() {
		// TODO Auto-generated method stub
		return R.layout.activity_search;
	}

	public View setActionBarLayout(int layoutId) {

		ActionBar actionBar = getActionBar();
		if (null != actionBar) {
			actionBar.setDisplayShowHomeEnabled(false);
			actionBar.setDisplayShowCustomEnabled(true);
			actionBar.setDisplayShowTitleEnabled(false);
			LayoutInflater inflator = (LayoutInflater) this
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			View v = inflator.inflate(layoutId, null);
			ActionBar.LayoutParams layout = new ActionBar.LayoutParams(
					LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
			actionBar.setCustomView(v, layout);
		}

		return actionBar.getCustomView();
	}

	@Override
	public void netWorkException(String msg) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void remoteFailMsg(String msg) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onComplete() {
		// TODO Auto-generated method stub
		
	}

}
